WeightedAverage (fld, fld), WeightedAverage (fld, fld, condFld), WeightedAverage (fld, fld, condFld, cond)

Basic and Crystal syntax.

Arguments
Returns

Fractional Number

Action

Enables you to calculate the weighted average of the specified fields. When you calculate a weighted average, you are actually calculating the average of one field and then using the values in another field to "weigh" the contribution of each value in the first field to the average. In a normal average, all the weights are equal to 1.

For example:

Examples

The following example is applicable to both Basic and Crystal syntax:

WeightedAverage({table.FIELD1}, {table.FIELD2})

Returns 3.5, where the two fields have four values each. Field1 has values of 3, 2, 5, and 1. Field2 has values of 0, 1, 1, and 0. WeightedAverage calculates as follows: (3*0 + 2*1 + 5*1 + 1*0)/sum{table.FIELD2}) = 3.5.

Note:    Using this function in a formula forces the formula to be evaluated at print time. For more information on evaluation time considerations, see the Evaluation Time functions.



Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com